<template>
	<div class="slider">
		<slider :disabled="disabled" :value="modelValue" @change="sliderChange" :block-size="15" :min="min" :max="max" show-value :step="step" />
	</div>
</template>

<script>
export default {
	name: "vRangeSlider",
	model: {
		prop: "value",
		event: "update:value",
	},
	props: {
		value: {
			type: [Number, String],
			default: 0,
		},
		min: {
			type: Number,
			default: 0,
		},
		max: {
			type: Number,
			default: 100,
		},
		step: {
			type: Number,
			default: 1,
		},
		range: {
			type: Boolean,
			default: false,
		},
		disabled: {
			type: Boolean,
			default: false,
		},
	},
	data() {
		return {}
	},
	computed: {
		modelValue: {
			get() {
				return this.value
			},
			set(val) {
				this.$emit("update:value", val)
			},
		},
	},
	methods: {
		sliderChange(e) {
			this.$emit("update:value", e.detail.value)
		},
	},
}
</script>
<style lang="scss" scoped>
.slider {
	width: 100%;
}
.range {
	display: flex;
	gap: 10rpx;
	align-items: center;
	.text {
		color: #888;
	}
}
</style>
